package com.zcz;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;


/**
 * @author 王卫帅
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableZuulProxy
@EnableFeignClients("com.zcz.client")
public class ZczGateway extends SpringBootServletInitializer {
    //1.必须创建war项目，需要创建好web项目的目录。
    //2.嵌入式Tomcat依赖scope指定provided。
    // 3.编写SpringBootServletInitializer类子类,并重写configure方法。
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注意这里要指向原先用main方法执行的Application启动类
        return builder.sources(ZczGateway.class);
    }
    public static void main(String[] args) {
        ConfigurableApplicationContext run =  SpringApplication.run(ZczGateway.class);
    }
}
